export class category {
  id?: number;
  name = '';
  pid = 0
  path = ''
  type = ''
  url = ''
  extra = ''
  status = true
  sort = 1

  constructor(data?: category) {
    data && this.setProps(data);
  }

  setProps(data: category) {
    (Object.keys(this) as Array<keyof Icategory>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Icategory = Omit<category, 'setProps'>